#include "Shape.h"

Shape::Shape():
parent(0),
offset(0) {
	parent = new Transform();
	hasCreatedParent = true;
	offset = new Transform();
}

Shape::Shape(Transform* const position):
Shape(position, 0.f, 0.f) {
	
}

Shape::Shape(Transform* const position, const Vector2D& offset):
Shape(position, offset.x, offset.y) {

}

Shape::Shape(Transform* const position, float xOffset, float yOffset):
parent(position),
offset(0) {
	offset = new Transform(xOffset, yOffset);
}

Shape::~Shape() {
	CleanUpParent();
	CleanUpOffset();
}

void Shape::CleanUpOffset() {
	if (offset != 0) {
		delete offset;
		offset = 0;
	}
	return;
}

void Shape::CleanUpParent() {
	if (parent != 0 && hasCreatedParent) {
		delete parent;
		parent = 0;
	}
	return;
}